import request from '@/utils/request'
const baseURL = '/classes'
// 获取所有的班级的信息
export const getAllClassInfo = () => request({
    url: `${baseURL}`,
    method: 'GET'
})


// 根据专业id和年级查找班级
export const getClassByMajorIdAndGradeId = (gradeId, marjorId) => request({
    url: `${baseURL}/${marjorId}/${gradeId}`,
    method: 'GET'
})

// 根据班级id获取信息
export const getClassById = (classId) => request({
    url: `${baseURL}/${classId}`,
    method: 'GET'
})


// 获取班级的详细信息
export const getClassDetail = (queryParams) => request({
    url: `${baseURL}/detail`,
    method: 'POST',
    data: queryParams
})


// 根据班级id删除班级
export const deleteClassById = (classId) => request({
    url: `${baseURL}/${classId}`,
    method: 'DELETE'
})


// 添加班级
export const addClass = (params) => request({
    url: `${baseURL}/add`,
    method: 'POST',
    data: params
})

// 修改按钮
export const updateClass = (params) => request({
    url: `${baseURL}/update/${params.classId}`,
    method: 'PUT',
    data: params
})



// 查询班级成员
export function queryClassMembers(data) {
    return request({
      url: `users/queryClassMembers`,
      method: 'POST',
      data
    })
}


// 根据当前用户ID获取班级信息
export const getClassByCurrentUser = (className) => request({
    url: `${baseURL}/all/byUserId`,
    method: 'GET',
    params: { className }
})